import networkx as nx
G=nx.Graph()

G.add_node(1)
G.add_node(2)

G.add_edge(1, 2)

print nx.degree(G)
